package com.czh.gateway.entity;


import com.czh.gateway.enums.ResponseResultEnum;
import lombok.Data;

import java.io.Serializable;

/**
 * 异常响应响应结果集 TODO tip
 * @author czh01
 * @version 1.0
 * @since 2024/8/23 上午 12:19
 */
@Data
public class ResponseResult implements Serializable {

    private int code;

    private String message;

    private Boolean success;


    public static ResponseResult error(ResponseResultEnum responseResultEnum){
        ResponseResult result = new ResponseResult();
        result.setError(responseResultEnum.getCode(),responseResultEnum.getMsg());
        return result;
    }
    private  void setError(int code,String msg){
        this.code= code;
        this.message = msg;
        this.success = false;
    }
}
